import {Injectable} from '@angular/core';

@Injectable({
    providedIn: 'root'
})
export class TokenService {

    constructor() {
    }

    get(): string {
        const token = sessionStorage.getItem('access_token');
        if (token) {
            return JSON.parse(token);
        } else {
            return null;
        }
    }

    set(token: string) {
        sessionStorage.setItem('access_token', JSON.stringify(token));
    }
}
